package bishiqiangxun;
import java.util.*;
public class Test1 {
    //题目:笔试强训 day31 第一题:小红的口罩
    //使用优先级队列
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        //创建一个小根堆 保证每次加的不舒服度是尽可能小

        int n = in.nextInt();
        int k = in.nextInt();
        PriorityQueue<Integer> queue  = new PriorityQueue<>();
        int[] a = new int[n];
        for(int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            queue.add(a[i]);  //加入小根堆中
        }


        if(queue.peek() > k) {
            System.out.println(0);
        }else {
            long sum = 0;
            int day = 0;
            while(sum <= k) {
                int ret = queue.poll();
                day++;
                sum += ret;
                queue.add(ret*2);
            }
            System.out.println(day-1);
        }

    }
}
